package ZMJ;

import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

public class shanchu extends JFrame implements ActionListener {

	JPanel p1, p2, p3;
	JTextField jt1;
	JTextField jt2;
	JButton jb1, jb2;
	JLabel l1, l2;

	shanchu() {
		super("删除");
		p1 = new JPanel();
		p2 = new JPanel();
		p3 = new JPanel();
		jb1 = new JButton("确认删除");
		jb1.addActionListener(this);
		jb2 = new JButton("取消");
		l1 = new JLabel("英文");
		l2 = new JLabel("中文");
		jt1 = new JTextField(15);
		jt2 = new JTextField(15);
		jb2.addActionListener(this);
		p1.add(l1, BorderLayout.NORTH);
		p1.add(jt1, BorderLayout.CENTER);
		p2.add(l2, BorderLayout.NORTH);
		p2.add(jt2, BorderLayout.CENTER);
		p3.add(jb1);
		p3.add(jb2);
		this.add(p1, BorderLayout.NORTH);
		this.add(p2, BorderLayout.CENTER);
		this.add(p3, BorderLayout.SOUTH);
		this.setVisible(true);
		this.setSize(250, 200);
		// this.setDefaultCloseOperation(EXIT_ON_CLOSE);
		this.setLocationRelativeTo(null);// 对话框居中

	}

	// public static void main(String[] args) {
	// new shanchu();
	// }

	@Override
	public void actionPerformed(ActionEvent e) {

		if (e.getSource() == jb2) {
			dispose();
			new danci();

		}
		if (e.getSource() == jb1) {
			String english = jt1.getText();
			String chinese = jt2.getText();
			if (WordUtil.delet(english, chinese)) {
				new shanchu2();

			}
		}

	}

}
